<?

class send_to {




// FUNCTION // validate update form
function validate_send($form_data){
	
	$my_array = array();
	
	if(!$form_data['name']) array_push($my_array, 'Please enter your name.');
	if(!$form_data['epost1']){
		array_push($my_array, 'Please enter your email address.');
	}elseif(!validate_email($form_data['epost1'])){
		array_push($my_array, 'Please enter a valid email address.');
	}
	if(!$form_data['epost2']){
		array_push($my_array, 'Please enter the recipients email address.');
	}elseif(!validate_email($form_data['epost2'])){
		array_push($my_array, 'Please enter a valid recipient email address.');
	}
	if(!$form_data['comments']) array_push($my_array, 'Please enter a short message.');
	
	return $my_array;
	
}
// END FUNCTION






// FUNCTION // send registration request
function send_email($values){


	$strmessage = $values['comments']." \r\n\r\n";
	$strmessage .= "http://".SITE_URL."/".$tidy_url."/nice_page.html \r\n\r\n";
	$strmessage .= $values['name']." \r\n\r\n";
	
	// HEADERS
	$headers  = "MIME-Version: 1.0\r\n";
	$headers .= "Content-type: text/plain; charset=iso-8859-1\r\n";
	$headers .= "From: ".SITE_NAME." <".$values['epost1'].">\r\n";

	// SEND EMAIL 
	if(mail($values['epost2'], $values['name']." I thought you might like this?", $strmessage, $headers)){
		return true;
	}


}
// END FUNCTION


// FUNCTION // insert a new url into the table
function insert_url($page_url){

	// use safe function
	$params = in($params);

	$sql = "INSERT INTO send_2_url
	SET	url = '".$page_url."',
	date = '".mktime()."' ";
		
	$result = mysql_query($sql) or die (mysql_error());
	
	return mysql_insert_id();
	
}
// END FUNCTION

}

?>